:root {
    --color-brand: #3b82f6;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --color-dark-gray: #1f2937;
    --color-medium-gray: #6b7280;
    --color-light-gray: #d1d5db;
    --color-extra-light-gray: #f9fafb;

    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-extra-light-gray);
    color: var(--color-dark-gray);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.header h1 {
    color: var(--color-brand);
    margin-bottom: 10px;
}

.header p {
    color: var(--color-medium-gray);
    font-size: 1.1em;
}

.main-content {
    display: flex;
    flex-direction: column; /* 调整为上下布局 */
    gap: 20px;
}

.input-section,
.analysis-section {
    flex: none; /* 不再使用flex: 1 */
    width: 100%; /* 占据全部宽度 */
    background-color: #fff;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.input-section h2,
.analysis-section h2 {
    color: var(--color-dark-gray);
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-light-gray);
    padding-bottom: 10px;
}

textarea {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95em;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.2s ease-in-out;
}

textarea:focus {
    border-color: var(--color-brand);
    outline: none;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-brand);
    color: #fff;
}

.btn-primary:hover {
    background-color: #2a64d9; /* Slightly darker brand color */
    transform: scale(0.98);
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn .icon {
    margin-right: 5px;
}

/* Analysis Steps */
.analysis-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step-item {
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.step-item.active {
    border-color: var(--color-brand);
    box-shadow: 0 0 10px rgba(var(--color-brand), 0.2);
}

.step-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--color-extra-light-gray);
    cursor: pointer;
    border-bottom: 1px solid var(--color-light-gray);
    transition: background-color 0.2s;
}

.step-header:hover {
    background-color: #f0f4f8;
}

.step-icon {
    font-size: 1.2em;
    margin-right: 10px;
    color: var(--color-medium-gray);
}

.step-item.active .step-icon {
    color: var(--color-brand);
}

.step-title {
    font-weight: bold;
    color: var(--color-dark-gray);
    flex-grow: 1;
}

.step-status {
    font-size: 0.9em;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
}

.status-pending {
    background-color: var(--color-medium-gray);
}

.status-running {
    background-color: var(--color-brand);
}

.status-completed {
    background-color: var(--color-success);
}

.status-error {
    background-color: var(--color-error);
}

.step-content {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.step-item.expanded .step-content {
    max-height: 2000px; /* 设置足够大的高度，保持动画效果的同时允许内容完整显示 */
    padding: 15px;
}

.step-content pre {
    background-color: #eee;
    padding: 10px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.step-content p {
    color: var(--color-dark-gray);
}

/* Loading Placeholder */
.loading-placeholder .step-icon {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
    text-align: center;
    padding: 15px;
    color: var(--color-medium-gray);
    font-size: 0.9em;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* AI分析引擎头部样式 */
.ai-engine-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 8px 0;
    padding: 8px 12px;
    background-color: #f8fafc;
    border-left: 4px solid var(--color-brand);
    border-radius: 0 4px 4px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-dark-gray);
}

.ai-engine-icon {
    color: var(--color-brand);
    font-size: 1.1em;
}

.ai-engine-label {
    flex-grow: 1;
}

.ai-engine-status {
    font-size: 0.8em;
    color: var(--color-medium-gray);
    display: flex;
    align-items: center;
    gap: 4px;
}

.thinking-pulse {
    width: 6px;
    height: 6px;
    background-color: var(--color-brand);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* AI思考过程内容样式 */
.ai-thinking-content {
    margin: 8px 0 16px 0;
    padding: 12px 16px;
    background-color: #ffffff;
    border-left: 2px solid #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Source Code Pro', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    color: #4a5568;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 结构化结果样式 */
.structured-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 8px 0;
    padding: 6px 12px;
    background-color: #f0f9ff;
    border-left: 4px solid var(--color-success);
    border-radius: 0 4px 4px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--color-dark-gray);
}

.structured-result-icon {
    color: var(--color-success);
    font-size: 1.1em;
}

.structured-result-content {
    margin: 8px 0;
    padding: 0 16px;
}

.entity-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.entity-item:last-child {
    border-bottom: none;
}

.entity-label {
    font-weight: 600;
    color: var(--color-medium-gray);
    min-width: 120px;
    font-size: 0.9em;
}

.entity-value {
    color: var(--color-dark-gray);
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #f8fafc;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .ai-thinking-content {
        font-size: 0.85em;
    }

    .entity-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .entity-label {
        min-width: auto;
    }
}

/* 思考过程折叠样式 */
.thinking-container {
    margin: 15px 0 10px 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background-color: #f9fafb;
}

.thinking-header {
    padding: 12px 16px;
    background-color: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    user-select: none;
    transition: background-color 0.2s ease;
}

.thinking-header:hover {
    background-color: #e5e7eb;
}

.thinking-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.thinking-title {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 思考中的动态点点点效果 */
.thinking-dots {
    animation: thinking-dots 1.5s infinite;
}

@keyframes thinking-dots {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* 脉冲点效果 */
.thinking-pulse {
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border-radius: 50%;
    animation: pulse 2s infinite;
    margin-left: auto;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

.thinking-content {
    padding: 0;
    background-color: #ffffff;
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid #e5e7eb;
}

.thinking-content pre {
    margin: 0;
    padding: 16px;
    background-color: transparent;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.thinking-content code {
    background-color: transparent;
    padding: 0;
    border: none;
    font-family: inherit;
}

/* 自然分析结果样式 */
.natural-analysis-result {
    margin: 10px 0 20px 0;
    padding: 0;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.natural-analysis-result p {
    margin: 8px 0;
}

.natural-analysis-result ul {
    margin: 8px 0 12px 20px;
    padding: 0;
}

.natural-analysis-result li {
    margin: 4px 0;
    color: #4b5563;
}

.judgment-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.judgment-true-positive {
    background-color: #fee2e2;
    color: #dc2626;
}

.judgment-false-positive {
    background-color: #dcfce7;
    color: #16a34a;
}

.judgment-uncertain {
    background-color: #fef3c7;
    color: #d97706;
}

/* 紧凑型解析结果显示样式 - 方案1: 表格式 */
.result-display {
    margin: 12px 0 16px 0;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.result-display h4 {
    margin: 0;
    padding: 12px 16px;
    background-color: #f8fafc;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-display h4::before {
    content: "🔍";
    font-size: 14px;
}

/* 表格式布局 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.result-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.result-table tr:hover {
    background-color: #f3f4f6;
}

.result-table td {
    padding: 8px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.result-table td:first-child {
    font-weight: 600;
    color: #6b7280;
    width: 120px;
    white-space: nowrap;
}

.result-table td:last-child {
    color: #374151;
    font-family: 'Consolas', 'Monaco', monospace;
    word-break: break-all;
}

/* 特殊值类型样式 */
.value-ip { color: #059669; font-weight: 500; }
.value-domain { color: #7c3aed; font-weight: 500; }
.value-event-type {
    color: #dc2626;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.value-url { color: #0891b2; font-weight: 500; }

/* 响应式设计 */
@media (max-width: 768px) {
    .result-table td:first-child {
        width: 100px;
        font-size: 12px;
    }

    .result-table td:last-child {
        font-size: 12px;
    }
}

/* 自定义滚动条样式 */
.thinking-content::-webkit-scrollbar {
    width: 6px;
}

.thinking-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.thinking-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.thinking-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 威胁情报工具样式 */
.threat-intel-container {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* 最终情报收集结果的特殊样式 */
.threat-intel-container.final-intelligence-result {
    background-color: #f0f9ff;
    border: 1px solid #0ea5e9;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.threat-intel-container.final-intelligence-result .threat-intel-header h4 {
    color: #0369a1;
}

.threat-intel-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.threat-intel-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.threat-intel-header h4 i {
    color: #4299e1;
    margin-right: 8px;
}

.threat-intel-tools {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.threat-intel-tool-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
}

.threat-intel-tool-card:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #edf2f7;
    border-radius: 6px;
    color: #4a5568;
}

.tool-info {
    flex-grow: 1;
}

.tool-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
    margin-bottom: 2px;
}

.tool-description {
    font-size: 12px;
    color: #718096;
}

.tool-status {
    flex-shrink: 0;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-running {
    background-color: #fef5e7;
    color: #d69e2e;
    border: 1px solid #f6e05e;
}

.status-success {
    background-color: #f0fff4;
    color: #38a169;
    border: 1px solid #9ae6b4;
}

.status-error {
    background-color: #fed7d7;
    color: #e53e3e;
    border: 1px solid #feb2b2;
}

.status-skipped {
    background-color: #e0e7ff;
    color: #4338ca;
    border: 1px solid #a5b4fc;
}

.tool-result {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.result-summary {
    font-size: 13px;
    line-height: 1.5;
}

.result-summary strong {
    color: #2d3748;
}

.result-details {
    margin-top: 8px;
}

.result-details details {
    cursor: pointer;
}

.result-details summary {
    font-size: 12px;
    color: #4299e1;
    padding: 4px 0;
    outline: none;
}

.result-details summary:hover {
    color: #3182ce;
}

.result-details pre {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    margin: 8px 0 0 0;
    font-size: 11px;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
}

.result-details code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: #2d3748;
}

.error-message {
    color: #e53e3e;
    font-size: 12px;
    padding: 8px;
    background-color: #fed7d7;
    border: 1px solid #feb2b2;
    border-radius: 4px;
}

/* 专家判断结果样式 */
.expert-judgment-result {
    margin: 15px 0;
    padding: 16px;
    background-color: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.expert-judgment-result h4 {
    margin: 0 0 12px 0;
    color: #0369a1;
    font-size: 16px;
    font-weight: 600;
}

.expert-judgment-result h4 i {
    color: #3b82f6;
    margin-right: 8px;
}

.judgment-content {
    margin: 0;
}

.judgment-content p {
    margin: 8px 0;
}

.judgment-content strong {
    color: #1f2937;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .threat-intel-tools {
        gap: 8px;
    }

    .threat-intel-tool-card {
        padding: 10px;
    }

    .tool-header {
        gap: 8px;
    }

    .tool-icon {
        width: 28px;
        height: 28px;
    }

    .tool-title {
        font-size: 13px;
    }

    .tool-description {
        font-size: 11px;
    }
}